﻿#region Copyright
/// <copyright>
/// Copyright (c) 2008 Ilia Shramko.
/// Released under the terms of the GNU General Public License.
/// </copyright>
#endregion

using System;
using System.Collections.Generic;
using System.Text;

namespace Osh.Media
{
	public class MediaTree : IMediaTree
	{
		private IMediaLibrary _library;
		private string _id;
		private string _name;
		private MediaFolderCollection _folders;
		private IList<IMediaFolder> _folderList;

		public MediaTree(IMediaLibrary library)
			: this(library, Guid.NewGuid().ToString(), string.Empty)
		{
		}

		public MediaTree(IMediaLibrary library, string id, string name)
			: this(library, id, name, new List<IMediaFolder>())
		{
		}

		public MediaTree(IMediaLibrary library, string id, string name, IList<IMediaFolder> folders)
		{
			_library = library;
			_id = id;
			_name = name;
			_folderList = folders;
			_folders = new MediaFolderCollection(folders);
		}

		protected virtual IList<IMediaFolder> FolderList
		{
			get { return _folderList; }
		}

		#region IMediaTree
		public virtual IMediaLibrary Library
		{
			get { return _library; }
			protected set { _library = value; }
		}

		public virtual string Id
		{
			get { return _id; }
			protected set { _id = value; }
		}

		public virtual string Name
		{
			get { return _name; }
			protected set { _name = value; }
		}

		public virtual MediaFolderCollection Folders
		{
			get { return _folders; }
		}
		#endregion IMediaTree

	}
}
